﻿/************************************************************************
 * Copyright (c) 2008, Jason Whitehorn (jason.whitehorn@gmail.com)
 * All rights reserved.
 * 
 * Source code and binaries distributed under the terms of the included
 * license, see license.txt for details.
 ************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;

namespace ContractTest.Assertions {
    /// <summary>
    /// Static factory class for asserters.
    /// </summary>
    public static class ContractAssert {
        private static Type _typeAsserterType = typeof (TypeAssert);
        private static ITypeAsserter _typeAsserter;

        /// <summary>
        /// Gets or Sets the implementation Type for ITypeAsserter.
        /// </summary>
        public static Type TypeAsserterType {
            get { return _typeAsserterType; }
            set {
                 _typeAsserterType = value;
                _typeAsserter = null;
            }
        }

        /// <summary>
        /// Gets the implementation of ITypeAsserter.
        /// </summary>
        public static ITypeAsserter Type {
            get {
                if (_typeAsserter == null)
                    _typeAsserter = (ITypeAsserter)Activator.CreateInstance(_typeAsserterType);
                return _typeAsserter;
            }
        }
    }
}
